// @ts-ignore
const ScriptReload = await import("modules/script_reload.js");
// 客户端
// @ts-ignore
const ClientUtils = await import("modules/client_utils.js");
// @ts-ignore
const HttpResUtils = await import("modules/http_res_utils.js");
// @ts-ignore
const HttpReQUtils = await import("modules/http_req_utils.js");

// 全局模块
class CustomGlobalModules {
    //加载
    load = async () => {
        //商城数据   
        _ReloadCacheData.add("data/shopping_mall_data.js");
        this.ShoppingMallData = await import("data/shopping_mall_data.js");
        //商店数据
        _ReloadCacheData.add("data/shop_store_data.js");
        this.ShopStoreData = await import("data/shop_store_data.js");
        // 聊天
        _ReloadCacheData.add("modules/chat_utils.js");
        this.ChatUtils = await import("modules/chat_utils.js");
        // 所有物品信息
        _ReloadCacheData.add("data/all_item_data.js");
        this.AllItemData = await import("data/all_item_data.js");
        // 其他物品数据
        _ReloadCacheData.add("data/item_ext_data.js");
        this.ItemExtData = await import("data/item_ext_data.js");
        // 物品脚本枚举
        _ReloadCacheData.add("items/enums.js");
        this.ItemEnums = await import("items/enums.js");
        // 物品
        _ReloadCacheData.add("modules/item_utils.js");
        this.ItemUtils = await import("modules/item_utils.js");
        // 角色
        _ReloadCacheData.add("modules/characters.js");
        this.Characters = await import("modules/characters.js");
        // 角色任务
        _ReloadCacheData.add("modules/characters_task.js");
        this.CharactersTask = await import("modules/characters_task.js");
        // 账号
        _ReloadCacheData.add("modules/accounts.js");
        this.Accounts = await import("modules/accounts.js");
        // 角色其他数据
        _ReloadCacheData.add("data/characters_data.js");
        this.CharactersExt = await import("data/characters_data.js");
        // 队伍
        _ReloadCacheData.add("modules/team_utils.js");
        this.TeamUtils = await import("modules/team_utils.js");
        // 地图
        _ReloadCacheData.add("modules/map_utils.js");
        this.MapUtils = await import("modules/map_utils.js");
        // 背包
        _ReloadCacheData.add("modules/items_utils.js");
        this.ItemsUils = await import("modules/items_utils.js");
        // 战斗
        _ReloadCacheData.add("fight/fight_utils.js");
        this.FightUtils = await import("fight/fight_utils.js");
        // 战斗指令
        _ReloadCacheData.add("fight/fight_cmd_utils.js");
        this.FightCmdUtils = await import("fight/fight_cmd_utils.js");
        // 战斗单位
        _ReloadCacheData.add("fight/fight_unit_utils.js");
        this.FightUnitUtils = await import("fight/fight_unit_utils.js");
        // 战斗结算
        _ReloadCacheData.add("fight/fight_settlement_utils.js");
        this.FightSettlementUtils = await import("fight/fight_settlement_utils.js");
        // 战斗计算
        _ReloadCacheData.add("fight/fight_computing_utils.js");
        this.FightComputingUtils = await import("fight/fight_computing_utils.js");
        // 战斗状态
        _ReloadCacheData.add("fight/fight_status_utils.js");
        this.FightStatusUtils = await import("fight/fight_status_utils.js");
        // 战斗技能
        _ReloadCacheData.add("fight/fight_skill_utils.js");
        this.FightSkillUtils = await import("fight/fight_skill_utils.js");
        // 物理技能
        _ReloadCacheData.add("fight/fight_ad_skill_utils.js");
        this.FightADSkillUtils = await import("fight/fight_ad_skill_utils.js");
        // 物理技能
        _ReloadCacheData.add("fight/fight_ap_skill_utils.js");
        this.FightAPSkillUtils = await import("fight/fight_ap_skill_utils.js");
        // 普通攻击
        _ReloadCacheData.add("fight/fight_normal_attack_utils.js");
        this.FightNormalAttackUtils = await import("fight/fight_normal_attack_utils.js");
        // 战斗物理攻击
        _ReloadCacheData.add("fight/fight_physical_attack.js");
        this.FightPhysicalAttack = await import("fight/fight_physical_attack.js");
        // 战斗恢复技能
        _ReloadCacheData.add("fight/fight_regen_skill_utils.js");
        this.FightRegenSkillUtils = await import("fight/fight_regen_skill_utils.js");
        // 战斗增益减益技能
        _ReloadCacheData.add("fight/fight_buff_skill_utils.js");
        this.FightBuffSkillUtils = await import("fight/fight_buff_skill_utils.js");
        // 战斗封印技能
        _ReloadCacheData.add("fight/fight_seal_skill_utils.js");
        this.FightSealSkillUtils = await import("fight/fight_seal_skill_utils.js");
        // 战斗固定伤害技能
        _ReloadCacheData.add("fight/fight_final_skill_utils.js");
        this.FightFinalSkillUtils = await import("fight/fight_final_skill_utils.js");
        // 战斗道具
        _ReloadCacheData.add("fight/fight_item_utils.js");
        this.FightItemUtils = await import("fight/fight_item_utils.js");
        // 随机数  
        _ReloadCacheData.add("modules/random_utils.js");
        this.RandomUtils = await import("modules/random_utils.js");
        // 助战
        _ReloadCacheData.add("modules/help_fight.js");
        this.HelpFight = await import("modules/help_fight.js");
        // 怪物
        _ReloadCacheData.add("modules/monster.js");
        this.Monster = await import("modules/monster.js");
        // 怪物数据
        _ReloadCacheData.add("data/monster_data.js");
        this.MonsterData = await import("data/monster_data.js");
        // 怪物阶段属性
        _ReloadCacheData.add("data/monster_level_attribute.js");
        this.MonsterLevelAttribute = await import("data/monster_level_attribute.js");
        // 染色
        _ReloadCacheData.add("data/rgb.js");
        this.RGB = await import("data/rgb.js");
        // 活动数据
        _ReloadCacheData.add("data/activity_data.js");
        this.ActivityData = await import("data/activity_data.js");
        // 地图npc数据
        _ReloadCacheData.add("data/map_npc.js");
        this.MapNpcData = await import("data/map_npc.js");
        // 技能数据
        _ReloadCacheData.add("data/skill_data.js");
        this.SkillData = await import("data/skill_data.js");
        // 地图传送点
        _ReloadCacheData.add("data/map_delivery_point.js");
        this.MapDeliveryPoint = await import("data/map_delivery_point.js");
        // 帮派
        _ReloadCacheData.add("modules/gang_utils.js");
        this.GangUtils = await import("modules/gang_utils.js");
        // GM工具
        _ReloadCacheData.add("modules/gm_utils.js");
        this.GmUtils = await import("modules/gm_utils.js");
        // 宝宝工具
        _ReloadCacheData.add("modules/pet.js");
        this.Pet = await import("modules/pet.js");
        // 宝宝数据
        _ReloadCacheData.add("data/pet_data.js");
        this.PetData = await import("data/pet_data.js");
        // 坐骑
        _ReloadCacheData.add("modules/mounts.js");
        this.Mounts = await import("modules/mounts.js");
        // 门派
        _ReloadCacheData.add("modules/sects.js");
        this.Sects = await import("modules/sects.js");
        // 技能
        _ReloadCacheData.add("modules");
        this.Skill = await import("modules/skill.js");
        // 事件回调
        _ReloadCacheData.add("event_callback/callback.js");
        this.EventCallback = await import("event_callback/callback.js");
        // 经脉数据
        _ReloadCacheData.add("data/jing_mai_data.js");
        this.JingMaiData = await import("data/jing_mai_data.js");
        // 内丹数据
        _ReloadCacheData.add("data/nei_dan_data.js");
        this.NeiDanData = await import("data/nei_dan_data.js");
        // 副本工具
        _ReloadCacheData.add("modules/dungeon_utils.js");
        this.DungeonUtils = await import("modules/dungeon_utils.js");
        // 好友工具
        _ReloadCacheData.add("modules/friend_utils.js");
        this.FriendUtils = await import("modules/friend_utils.js");
        // 遇怪检测工具
        _ReloadCacheData.add("modules/map_monster.js");
        this.MapMonster = await import("modules/map_monster.js");
        // 遇怪检测工具
        _ReloadCacheData.add("bot/one_bot_utils.js");
        // onebot工具
        this.OneBotUtils = await import("bot/one_bot_utils.js");
    }

    reload = async (path) => {
        if (path.startsWith("modules/") || path.startsWith("event_callback/") || path.startsWith("data/") || path.startsWith("fight/") ||  path.startsWith("items/enums.js") ||  path.startsWith("bot/")) {
            console.log(`重载模块脚本 ${path}`);
            switch (path) {
                case "data/shopping_mall_data.js":
                    this.ShoppingMallData = await import("data/shopping_mall_data.js");
                    break;
                case "data/shop_store_data.js":
                    this.ShopStoreData = await import("data/shop_store_data.js");
                    break;
                case "modules/chat_utils.js":
                    this.ChatUtils = await import("modules/chat_utils.js");
                    break;
                case "data/all_item_data.js":
                    G.AllItemData = await import("data/all_item_data.js");
                    console.log( this.AllItemData)
                    break;
                case "data/item_ext_data.js":
                    this.ItemExtData = await import("data/item_ext_data.js");
                    break;
                case "items/enums.js":
                    this.ItemEnums = await import("items/enums.js");
                    break;
                case "modules/item_utils.js":
                    this.ItemUtils = await import("modules/item_utils.js");
                    break;
                case "modules/characters.js":
                    this.Characters = await import("modules/characters.js");
                    break;
                case "modules/characters_task.js":
                    this.CharactersTask = await import("modules/characters_task.js");
                    break;
                case "modules/accounts.js":
                    this.Accounts = await import("modules/accounts.js");
                    break;
                case "data/characters_data.js":
                    this.CharactersExt = await import("data/characters_data.js");
                    break;
                case "modules/team_utils.js":
                    this.TeamUtils = await import("modules/team_utils.js");
                    break;
                case "modules/map_utils.js":
                    this.MapUtils = await import("modules/map_utils.js");
                    break;
                case "modules/items_utils.js":
                    this.ItemsUils = await import("modules/items_utils.js");
                    break;
                case "fight/fight_utils.js":
                    this.FightUtils = await import("fight/fight_utils.js");
                    break;
                case "fight/fight_cmd_utils.js":
                    this.FightCmdUtils = await import("fight/fight_cmd_utils.js");
                    break;
                case "fight/fight_unit_utils.js":
                    this.FightUnitUtils = await import("fight/fight_unit_utils.js");
                    break;
                case "fight/fight_settlement_utils.js":
                    this.FightSettlementUtils = await import("fight/fight_settlement_utils.js");
                    break;
                case "fight/fight_computing_utils.js":
                    this.FightComputingUtils = await import("fight/fight_computing_utils.js");
                    break;
                case "fight/fight_status_utils.js":
                    this.FightStatusUtils = await import("fight/fight_status_utils.js");
                    break;
                case "fight/fight_skill_utils.js":
                    this.FightSkillUtils = await import("fight/fight_skill_utils.js");
                    break;
                case "fight/fight_ad_skill_utils.js":
                    this.FightADSkillUtils = await import("fight/fight_ad_skill_utils.js");
                    break;
                case "fight/fight_ap_skill_utils.js":
                    this.FightAPSkillUtils = await import("fight/fight_ap_skill_utils.js");
                    break;
                case "fight/fight_normal_attack_utils.js":
                    this.FightNormalAttackUtils = await import("fight/fight_normal_attack_utils.js");
                    break;
                case "fight/fight_physical_attack.js":
                    this.FightPhysicalAttack = await import("fight/fight_physical_attack.js");
                    break;
                case "fight/fight_regen_skill_utils.js":
                    this.FightRegenSkillUtils = await import("fight/fight_regen_skill_utils.js");
                    break;
                case "fight/fight_buff_skill_utils.js":
                    this.FightBuffSkillUtils = await import("fight/fight_buff_skill_utils.js");
                    break;
                case "fight/fight_seal_skill_utils.js":
                    this.FightSealSkillUtils = await import("fight/fight_seal_skill_utils.js");
                    break;
                case "fight/fight_final_skill_utils.js":
                    this.FightFinalSkillUtils = await import("fight/fight_final_skill_utils.js");
                    break;
                case "fight/fight_item_utils.js":
                    this.FightItemUtils = await import("fight/fight_item_utils.js");
                    break;
                case "modules/random_utils.js":
                    this.RandomUtils = await import("modules/random_utils.js");
                    break;
                case "modules/help_fight.js":
                    this.HelpFight = await import("modules/help_fight.js");
                    break;
                case "modules/monster.js":
                    this.Monster = await import("modules/monster.js");
                    break;
                case "data/monster_data.js":
                    this.MonsterData = await import("data/monster_data.js");
                    break;
                case "data/monster_level_attribute.js":
                    this.MonsterLevelAttribute = await import("data/monster_level_attribute.js");
                    break;
                case "data/rgb.js":
                    this.RGB = await import("data/rgb.js");
                case "data/activity_data.js":
                    this.ActivityData = await import("data/activity_data.js");
                    break;
                case "data/map_npc.js":
                    this.MapNpcData = await import("data/map_npc.js");
                    break;
                case "data/skill_data.js":
                    this.SkillData = await import("data/skill_data.js");
                    break;
                case "data/map_delivery_point.js":
                    this.MapDeliveryPoint = await import("data/map_delivery_point.js");
                    break;
                case "modules/gang_utils.js":
                    this.GangUtils = await import("modules/gang_utils.js");
                    break;
                case "modules/gm_utils.js":
                    this.GmUtils = await import("modules/gm_utils.js");
                    break;
                case "modules/pet.js":
                    this.Pet = await import("modules/pet.js");
                    break;
                case "data/pet_data.js":
                    this.PetData = await import("data/pet_data.js");
                    break;
                case "modules/mounts.js":
                    this.Mounts = await import("modules/mounts.js");
                    break;
                case "modules/sects.js":
                    this.Sects = await import("modules/sects.js");
                    break;
                case "modules":
                    this.Skill = await import("modules/skill.js");
                    break;
                case "event_callback/callback.js":
                    this.EventCallback = await import("event_callback/callback.js");
                    break;
                case "data/jing_mai_data.js":
                    this.JingMaiData = await import("data/jing_mai_data.js");
                    break;
                case "data/nei_dan_data.js":
                    this.NeiDanData = await import("data/nei_dan_data.js");
                    break;
                case "modules/dungeon_utils.js":
                    // 副本工具
                    this.DungeonUtils = await import("modules/dungeon_utils.js");
                    break;
                case "modules/friend_utils.js":
                    // 好友工具
                    this.FriendUtils = await import("modules/friend_utils.js");
                    break;
                case "modules/map_monster.js":
                    // 遇怪检测工具
                    this.MapMonster = await import("modules/map_monster.js");
                    break;
                case "bot/one_bot_utils.js":
                    // onebot工具
                    this.OneBotUtils = await import("bot/one_bot_utils.js");
                    break;
                default:
                    break;
            }
        }
    }
}
//预先导入常用模块
const G = new CustomGlobalModules();
// @ts-ignore
await G.load();
//预先导入处理脚本
// @ts-ignore
await ScriptReload.load_script_data();